<template>
  <div class="app">
      <h4>这是App组件</h4>
      <!-- <child/> -->
      <Suspense>
        <template v-slot:default>
          <child/>
        </template>
        <template v-slot:fallback>
          <div>child加载中......</div>
        </template>
      </Suspense>
      
  </div>
</template>

<script>
  // import child from './components/child'  //静态引入
  import { defineAsyncComponent } from 'vue';
  const child  = defineAsyncComponent(()=>import('./components/child.vue')) //异步引入
  export default {
    name:'App',
    components:{child},
    setup(){
    }
  }
</script>

<style scoped>
  .app{
    background-color: gray;
    padding: 15px;
  }
</style>
